package tasktwo;

/**
 * @author wuwenfa
 */
public class IndexMain {
    //    设计3个线程，其中2个线程对数字index进行 +1 操作，另外一个线程进行 -1 操作，要求线程安全

    public static int index = 0;

    public static void main(String[] args) {
        Object lock = new Object();

        ThreadIndexAdd one = new ThreadIndexAdd(lock);
        ThreadIndexAdd two = new ThreadIndexAdd(lock);
        ThreadIndexReduce three = new ThreadIndexReduce(lock);

        one.start();
        two.start();
        three.start();
    }

}
